<template>
  <div class="app-container">
    <el-table
    :data="list"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="plat"
      label="平台"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="名称"
      width="350">
    </el-table-column>
    <el-table-column
      prop="store"
      label="仓库"
      width="120">
    </el-table-column>
    <el-table-column
      prop="branch"
      label="分支"
      width="350">
    </el-table-column>
    <el-table-column
      prop="carry"
      label="执行类型"
      width="300">
    </el-table-column>
    <el-table-column
      prop="creator"
      label="创建人"
      width="120">
    </el-table-column>
    <el-table-column
      prop="create_date"
      label="创建时间"
      width="150">
       </el-table-column>
    <el-table-column
      label="操作"
      width="150">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
        <el-button type="text" size="small">编辑</el-button>
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>

<script>
import { getList } from '@/api/table'

export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'gray',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    return {
      list: null,
      listLoading: true
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.listLoading = true
      getList().then(response => {
        this.list = response.data.results
        console.log(response)
        //this.list = response.results
       // this.listLoading = false
      })
      .catch(e => {
        console.log(e)
      })
    }
  }
}
</script>
